<?php
	include_once("db/CaseType.inc");
?>

<script language="javascript"><!--
	function deleteCaseType(id) {
		var answer = confirm("Are you sure you want to delete the case type with ID=" + id + "?");
		
		if (answer) {
			window.location.href = "?action=deleteCaseType&id=" + id;
		}
	}

--></script>

<h1>Case Type</h1>

<a href="?action=editCaseType">Add Case Type</a><br/>

<table cellspacing="0">
	<tr class="first">
		<td>&nbsp;</td>
		<td>ID</td>
		<td>Name</td>
	</tr>
	
<?php
	$descArray = CaseType::getAllCaseTypes();
	foreach ($descArray as $d) {
?>

	<tr>
		<td>&nbsp;
			<a href="?action=editCaseType&code=<?php print $d->id ?>" >Edit</a>
			&nbsp;|&nbsp;
			<a href="javascript:deleteCaseType(<?php print $d->id ?>)" >Delete</a>&nbsp;
		</td>
		<td><?php print $d->id ?></td>
		<td><?php print $d->name ?>&nbsp;</td>
	</tr>

<?php
	}
?>

</table>